.class public Lrexsee/content/RexseeContent;
.super Ljava/lang/Object;
.source "RexseeContent.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final INTERFACE_NAME:Ljava/lang/String; = "Content"


# instance fields
.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mContext:Landroid/content/Context;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 1
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 33
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 34
    iput-object p1, p0, Lrexsee/content/RexseeContent;->mBrowser:Lrexsee/core/browser/Browser;

    .line 35
    iget-object v0, p0, Lrexsee/content/RexseeContent;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v0}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/content/RexseeContent;->mContext:Landroid/content/Context;

    .line 36
    return-void
.end method

.method public static getContentColumns_(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
    .locals 9
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "contentUri"    # Landroid/net/Uri;

    .prologue
    .line 39
    if-nez p1, :cond_0

    const-string v1, "[]"

    .line 47
    :goto_0
    return-object v1

    .line 41
    :cond_0
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 42
    .local v0, "contentResolver":Landroid/content/ContentResolver;
    const/4 v2, 0x0

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    move-object v1, p1

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 43
    .local v6, "cursor":Landroid/database/Cursor;
    invoke-static {v6}, Lrexsee/core/utilities/Json;->toJsonColumns(Landroid/database/Cursor;)Ljava/lang/String;

    move-result-object v8

    .line 44
    .local v8, "rtn":Ljava/lang/String;
    invoke-interface {v6}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-object v1, v8

    .line 45
    goto :goto_0

    .line 46
    .end local v0    # "contentResolver":Landroid/content/ContentResolver;
    .end local v6    # "cursor":Landroid/database/Cursor;
    .end local v8    # "rtn":Ljava/lang/String;
    :catch_0
    move-exception v1

    move-object v7, v1

    .line 47
    .local v7, "e":Ljava/lang/Exception;
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "[Exception]"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7}, Ljava/lang/Exception;->getLocalizedMessage()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto :goto_0
.end method

.method public static getContentData_(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "contentUri"    # Landroid/net/Uri;
    .param p2, "columns"    # Ljava/lang/String;
    .param p3, "selection"    # Ljava/lang/String;
    .param p4, "sort"    # Ljava/lang/String;

    .prologue
    const/4 v1, 0x0

    .line 51
    if-nez p1, :cond_0

    const-string v1, "[]"

    .line 60
    :goto_0
    return-object v1

    .line 52
    :cond_0
    if-eqz p2, :cond_1

    const-string v1, ","

    invoke-virtual {p2, v1}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v1

    move-object v2, v1

    .line 54
    .local v2, "columns_":[Ljava/lang/String;
    :goto_1
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 55
    .local v0, "contentResolver":Landroid/content/ContentResolver;
    const/4 v4, 0x0

    move-object v1, p1

    move-object v3, p3

    move-object v5, p4

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 56
    .local v6, "cursor":Landroid/database/Cursor;
    invoke-static {v6}, Lrexsee/core/utilities/Json;->toJson(Landroid/database/Cursor;)Ljava/lang/String;

    move-result-object v8

    .line 57
    .local v8, "rtn":Ljava/lang/String;
    invoke-interface {v6}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-object v1, v8

    .line 58
    goto :goto_0

    .end local v0    # "contentResolver":Landroid/content/ContentResolver;
    .end local v2    # "columns_":[Ljava/lang/String;
    .end local v6    # "cursor":Landroid/database/Cursor;
    .end local v8    # "rtn":Ljava/lang/String;
    :cond_1
    move-object v2, v1

    .line 52
    goto :goto_1

    .line 59
    .restart local v2    # "columns_":[Ljava/lang/String;
    :catch_0
    move-exception v1

    move-object v7, v1

    .line 60
    .local v7, "e":Ljava/lang/Exception;
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v3, "[Exception]"

    invoke-direct {v1, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7}, Ljava/lang/Exception;->getLocalizedMessage()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto :goto_0
.end method

.method public static getContentData_(Lrexsee/core/browser/Browser;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
    .locals 6
    .param p0, "browser"    # Lrexsee/core/browser/Browser;
    .param p1, "contentUri"    # Landroid/net/Uri;
    .param p2, "columns"    # Ljava/lang/String;
    .param p3, "selection"    # Ljava/lang/String;
    .param p4, "sort"    # Ljava/lang/String;
    .param p5, "showProgress"    # Z
    .param p6, "cancelable"    # Z

    .prologue
    .line 64
    new-instance v0, Lrexsee/content/RexseeContent$1;

    move-object v1, p0

    move-object v2, p1

    move-object v3, p2

    move-object v4, p3

    move-object v5, p4

    invoke-direct/range {v0 .. v5}, Lrexsee/content/RexseeContent$1;-><init>(Lrexsee/core/browser/Browser;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 70
    .local v0, "runnable":Lrexsee/core/browser/clazz/SyncTask$StringRunnable;
    if-eqz p5, :cond_0

    .line 71
    new-instance v1, Lrexsee/core/browser/clazz/SyncTask;

    invoke-direct {v1}, Lrexsee/core/browser/clazz/SyncTask;-><init>()V

    invoke-virtual {v1, v0, p0, p6}, Lrexsee/core/browser/clazz/SyncTask;->run(Lrexsee/core/browser/clazz/SyncTask$StringRunnable;Lrexsee/core/browser/Browser;Z)Ljava/lang/String;

    move-result-object v1

    .line 73
    :goto_0
    return-object v1

    :cond_0
    new-instance v1, Lrexsee/core/browser/clazz/SyncTask;

    invoke-direct {v1}, Lrexsee/core/browser/clazz/SyncTask;-><init>()V

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-virtual {v1, v0, v2, v3}, Lrexsee/core/browser/clazz/SyncTask;->run(Lrexsee/core/browser/clazz/SyncTask$StringRunnable;Lrexsee/core/browser/Browser;Z)Ljava/lang/String;

    move-result-object v1

    goto :goto_0
.end method


# virtual methods
.method public getContentColumns(Ljava/lang/String;)Ljava/lang/String;
    .locals 2
    .param p1, "contentUri"    # Ljava/lang/String;

    .prologue
    .line 79
    iget-object v0, p0, Lrexsee/content/RexseeContent;->mContext:Landroid/content/Context;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    invoke-static {v0, v1}, Lrexsee/content/RexseeContent;->getContentColumns_(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getContentData(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
    .locals 7
    .param p1, "contentUri"    # Ljava/lang/String;
    .param p2, "columns"    # Ljava/lang/String;
    .param p3, "selection"    # Ljava/lang/String;
    .param p4, "sort"    # Ljava/lang/String;
    .param p5, "showProgress"    # Z
    .param p6, "cancelable"    # Z

    .prologue
    const-string v1, ""

    .line 82
    const-string v0, ""

    invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    const/4 p2, 0x0

    .line 83
    :cond_0
    const-string v0, ""

    invoke-virtual {p3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    const/4 p3, 0x0

    .line 84
    :cond_1
    const-string v0, ""

    invoke-virtual {p4, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    const/4 p4, 0x0

    .line 85
    :cond_2
    iget-object v0, p0, Lrexsee/content/RexseeContent;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    move-object v2, p2

    move-object v3, p3

    move-object v4, p4

    move v5, p5

    move v6, p6

    invoke-static/range {v0 .. v6}, Lrexsee/content/RexseeContent;->getContentData_(Lrexsee/core/browser/Browser;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 23
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 19
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/content/RexseeContent;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Content"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 27
    new-instance v0, Lrexsee/content/RexseeContent;

    invoke-direct {v0, p1}, Lrexsee/content/RexseeContent;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method
